﻿// <copyright file="AlertSettingsConfigurationElement.cs" company="http://www.dymetis.com">
//
// Copyright (c) 2011 Eddie Z. Lin.
//
// This source is subject to the Microsoft Public License.
// See http://www.opensource.org/licenses/ms-pl.
// All other rights reserved.
// 
// </copyright>

namespace Dymetis.TeamAlert.Configuration
{
    using System.ComponentModel;
    using System.Configuration;

    /// <summary>
    /// The AlertSettingsConfigurationElement Configuration Element.
    /// </summary>
    public partial class AlertSettingsConfigurationElement : ConfigurationElement
    {
        /// <summary>
        /// The XML name of the <see cref="XslSearchPath"/> property.
        /// </summary>
        internal const string XslSearchPathPropertyName = "xslSearchPath";

        /// <summary>
        /// The XML name of the <see cref="FromAddress"/> property.
        /// </summary>
        internal const string FromAddressPropertyName = "fromAddress";

        /// <summary>
        /// The XML name of the <see cref="EmailEnabled"/> property.
        /// </summary>
        internal const string EmailEnabledPropertyName = "emailEnabled";

        /// <summary>
        /// The XML name of the <see cref="SmtpServer"/> property.
        /// </summary>
        internal const string SmtpServerPropertyName = "smtpServer";

        /// <summary>
        /// Gets or sets the XslSearchPath.
        /// </summary>
        [Description("The XslSearchPath.")]
        [ConfigurationProperty(AlertSettingsConfigurationElement.XslSearchPathPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public string XslSearchPath
        {
            get
            {
                return (string)base[AlertSettingsConfigurationElement.XslSearchPathPropertyName];
            }

            set
            {
                base[AlertSettingsConfigurationElement.XslSearchPathPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets or sets the FromAddress.
        /// </summary>
        [Description("The FromAddress.")]
        [ConfigurationProperty(AlertSettingsConfigurationElement.FromAddressPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public string FromAddress
        {
            get
            {
                return (string)base[AlertSettingsConfigurationElement.FromAddressPropertyName];
            }

            set
            {
                base[AlertSettingsConfigurationElement.FromAddressPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether E-Mail notification is enabled.
        /// </summary>
        [Description("The EmailEnabled.")]
        [ConfigurationProperty(AlertSettingsConfigurationElement.EmailEnabledPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false, DefaultValue = true)]
        public bool EmailEnabled
        {
            get
            {
                return (bool)base[AlertSettingsConfigurationElement.EmailEnabledPropertyName];
            }

            set
            {
                base[AlertSettingsConfigurationElement.EmailEnabledPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets or sets the SmtpServer.
        /// </summary>
        [Description("The SmtpServer.")]
        [ConfigurationProperty(AlertSettingsConfigurationElement.SmtpServerPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public string SmtpServer
        {
            get
            {
                return (string)base[AlertSettingsConfigurationElement.SmtpServerPropertyName];
            }

            set
            {
                base[AlertSettingsConfigurationElement.SmtpServerPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets a value indicating whether the element is read-only.
        /// </summary>
        /// <returns>
        /// A value indicating whether the element is read-only.
        /// </returns>
        public override bool IsReadOnly()
        {
            return false;
        }
    }
}
